package br.com.pguide.activity;

import br.com.pguide.R;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class MainWindowTabActivity extends TabActivity {

	private String username;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		Intent it = getIntent();
		this.username = it.getStringExtra("username");

		setContentView(R.layout.main_new);
		
		TabHost tabHost = getTabHost();
		
		TabSpec spec_lista = tabHost.newTabSpec(getString(R.string.lista));
		spec_lista.setIndicator("", getResources().getDrawable(R.drawable.ic_menu_agenda));
		//spec_lista.setIndicator(getString(R.string.lista), getResources().getDrawable(R.drawable.ic_menu_agenda));
		Intent it_lista = new Intent(this, MinhaListaDeComprasActivity.class).putExtra("username", this.username);
		spec_lista.setContent(it_lista);
		
		TabSpec spec_pesquisa = tabHost.newTabSpec(getString(R.string.pesquisar));
		spec_pesquisa.setIndicator("", getResources().getDrawable(R.drawable.ic_menu_search));
		Intent it_pesquisa = new Intent(this, PesquisaActivity.class).putExtra("username", this.username);
		spec_pesquisa.setContent(it_pesquisa);
		
		TabSpec spec_perfil = tabHost.newTabSpec(getString(R.string.perfil));
		spec_perfil.setIndicator("", getResources().getDrawable(R.drawable.ic_menu_allfriends));
		Intent it_perfil = new Intent(this, MeuPerfilActivity.class).putExtra("username", this.username);
		spec_perfil.setContent(it_perfil);
		
		TabSpec spec_preferencias = tabHost.newTabSpec(getString(R.string.preferencias));
		spec_preferencias.setIndicator("", getResources().getDrawable(R.drawable.ic_menu_preferences));
		Intent it_preferencias = new Intent(this, PreferenciasActivity.class).putExtra("username", this.username);
		spec_preferencias.setContent(it_preferencias);
		
		TabSpec spec_sair = tabHost.newTabSpec(getString(R.string.sair));
		spec_sair.setIndicator("", getResources().getDrawable(R.drawable.ic_menu_revert));
		Intent it_sair = new Intent(this, SairActivity.class).putExtra("username", this.username);
		spec_sair.setContent(it_sair);

		tabHost.addTab(spec_lista);
		tabHost.addTab(spec_pesquisa);
		tabHost.addTab(spec_perfil);
		tabHost.addTab(spec_preferencias);
		tabHost.addTab(spec_sair);
	}
	
}
